<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>vert.x CURD demo</title>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="lib/angualr.js"></script>
<script type="text/javascript" src="app/app.js"></script>
</head>
<body ng-app="app">
	<div class="container" ng-controller="shopCartController">
		<div align="center">使用vert.x构建简单的web应用</div>
		
		<!-- 增加添加数据弹窗框 -->
		<div align="right"><button type="button" class="btn btn-primary" ng-disabled="newGood" ng-click="addGoods()">增加商品</button></div>
		
		<!--弹窗框 -->
		<div>
		<table class="table table-striped">
			<caption>购物车</caption>
			<thead>
				<tr>
					<th>商品名称</th>
					<th>商品价格</th>
					<th>商品数量</th>
					<th>总价</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="item in data">
					<td>
					  <span ng-show="!item.edit">{{item.goodName}}</span>
		              <span ng-show="item.edit"><input type="text" ng-model="item.goodName"/></span>
				    </td>
					<td>
					    <span ng-show="!item.edit">{{item.goodMoney}}</span>
					    <span ng-show="item.edit"><input type="text" ng-model="item.goodMoney"/></span>
					</td>
					<td>
					   <span ng-show="!item.edit">{{item.goodCount}}</span>
					   <span ng-show="item.edit">
						<button type="button" class="btn btn-primary"
							ng-click="add(item)">+</button> <input type="text"
						ng-model="item.goodCount" class="text-primary" />
						<button type="button" class="btn btn-primary"
							ng-click="diff(item)">-</button>
					   </span>
					</td>
					<td>{{item.goodCount*item.goodMoney}}</td>
					<td>
					    <span ng-show="!item.edit">
						 <button type="button" ng-click="remove(item)"
							class="btn btn-danger">移除</button>
						 <button type="button" class="btn btn-primary" ng-disabled="newGood" ng-click="editGood(item)">编辑</button>
						</span>
					    <span ng-show="item.edit">
						  <button type="button" class="btn btn-primary" ng-click="saveGood(item)">保存</button> 
						  <button type="button" class="btn btn-primary" ng-click="cancelGood(item)">取消</button>
						</span>
					</td>
				</tr>
				<!-- 合计-->
			</tbody>
		</table>
		</div>	
	</div>
</body>
</html>